01 - Resistors Model

Definicion de variables para calcular la resistencia del material de 30um x 30um y delta-xy=1.4um Definicion de la funcion para calcular R

In [1]:
%matplotlib inline
import math
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
import pylab as plb
def matrix(m_length,m_width):
    "Return matrix with no homogeneus resitivity"
    m = np.zeros((m_length,m_width))
    return m
def resistance(resistivity,L,W,t):
    "Return a value of resistance for a single shape"
    R = (L*resistivity)/(W*t)
    return R
Material_length=30e-6
step = 1.4e-6
thickness = 0.05e-6
resistivity_base = 1.5e-6
resistance(resistivity_base,step,step,thickness)
size_m = Material_length/step
delta_resistivity=0.005e-6
plt.style.use('ggplot')

Matriz de resistividad ideal


In [2]:
I = matrix(int(size_m),int(size_m))
for i in range(0,int(math.sqrt(I.size))):
    for j in range(0,int(math.sqrt(I.size))):
        I[i][j]= resistance(resistivity_base,step,step,thickness)
        
plt.matshow(I)
plt.show()


Valor de la resistencia ideal por cuadro


In [3]:
resistance(resistivity_base,step,step,thickness)


Out[3]:
30.000000000000004

Creacion de la matrix del material con variaciones en la resistencia


In [4]:
M = matrix(int(size_m),int(size_m))
math.sqrt(M.size)
for i in range(0,int(math.sqrt(M.size))):
    for j in range(0,int(math.sqrt(M.size))):
        M[i][j]= resistance(resistivity_base+(i+j)*delta_resistivity,step,step,thickness)

Tamaño de la matrix LxL


In [5]:
math.sqrt(M.size)


Out[5]:
21.0

Visualizacion de la variacion de resistencia en el material


In [6]:
plt.matshow(M)
plt.show()


Inicializando la matriz de dibujo en el material


In [7]:
paint_matrix = matrix(int(size_m),int(size_m))
plt.matshow(paint_matrix)
plt.show()


Diseño 1 de dibujo resistencias perpenticulares


In [8]:
paint_matrix = matrix(int(size_m),int(size_m))
RA = []
for i in range(21):
       RA.append(1)
RB = []
for i in range(21):
       RB.append(2)
paint_matrix[0:21,9]=RA
paint_matrix[0:21,11]=RB
plt.matshow(paint_matrix)
plt.show()


Diseño 2 de dibujo resistencias horizontales en la misma fila


In [9]:
paint_matrix = matrix(int(size_m),int(size_m))
RA = []
for i in range(10):
       RA.append(1)
RB = []
for i in range(10):
       RB.append(2)
paint_matrix[10,0:10]=RA
paint_matrix[10,11:21]=RB
plt.matshow(paint_matrix)
plt.show()



In [10]:
Diseño 3 de dibujo resistencias verticales en la misma columna


  File "<ipython-input-10-e5ca3472acad>", line 1
    Diseño 3 de dibujo resistencias verticales en la misma columna
           ^
SyntaxError: invalid syntax

In [11]:
paint_matrix = matrix(int(size_m),int(size_m))
RA = []
for i in range(10):
       RA.append(1)
RB = []
for i in range(10):
       RB.append(2)
paint_matrix[0:10,10]=RA
paint_matrix[11:21,10]=RB
plt.matshow(paint_matrix)
plt.show()


Diseño 4 de dibujo modelo ABABAB


In [12]:
paint_matrix = matrix(int(size_m),int(size_m))
RA = []
for i in range(21):
       RA.append(1)
RB = []
for i in range(21):
       RB.append(2)
paint_matrix[0:21,3]=RB
paint_matrix[0:21,5]=RA
paint_matrix[0:21,7]=RB
paint_matrix[0:21,9]=RA
paint_matrix[0:21,11]=RB
paint_matrix[0:21,13]=RA
paint_matrix[0:21,15]=RB
paint_matrix[0:21,17]=RA

plt.matshow(paint_matrix)
plt.show()


Diseño 5 de dibujo modelo ABBAABBA


In [13]:
paint_matrix = matrix(int(size_m),int(size_m))
RA = []
for i in range(21):
       RA.append(1)
RB = []
for i in range(21):
       RB.append(2)
paint_matrix[0:21,3]=RA
paint_matrix[0:21,5]=RB
paint_matrix[0:21,7]=RB
paint_matrix[0:21,9]=RA
paint_matrix[0:21,11]=RA
paint_matrix[0:21,13]=RB
paint_matrix[0:21,15]=RB
paint_matrix[0:21,17]=RA

plt.matshow(paint_matrix)
plt.show()


Diseño 6 de centroide comun


In [14]:
paint_matrix = matrix(int(size_m),int(size_m))
RA = []
for i in range(3):
       RA.append(1)
RB = []
for i in range(3):
       RB.append(2)
RC = []
for i in range(3):
       RC.append(3)
RD = []
for i in range(3):
       RD.append(4)

        
paint_matrix[3:6,7]=RA
paint_matrix[3:6,9]=RC
paint_matrix[3:6,11]=RC
paint_matrix[3:6,13]=RB        
paint_matrix[7:10,7]=RD
paint_matrix[7:10,9]=RA
paint_matrix[7:10,11]=RB
paint_matrix[7:10,13]=RD
paint_matrix[11:14,7]=RD
paint_matrix[11:14,9]=RB
paint_matrix[11:14,11]=RA
paint_matrix[11:14,13]=RD
paint_matrix[15:18,7]=RB
paint_matrix[15:18,9]=RC
paint_matrix[15:18,11]=RC
paint_matrix[15:18,13]=RA


plt.matshow(paint_matrix)
plt.show()



In [15]:
#paint_matrix

Calculo de las resistencias Ideal, real


In [16]:
def RealresistanceA():
    "Return a value of resistance RA"
    R=0
    for i in range(0,int(math.sqrt(M.size))):
        for j in range(0,int(math.sqrt(M.size))):
            if paint_matrix[i][j]==1:
                R +=M[i][j]
    return R
def RealresistanceB():
    "Return a value of resistance RB"
    R=0
    for i in range(0,int(math.sqrt(M.size))):
        for j in range(0,int(math.sqrt(M.size))):
            if paint_matrix[i][j]==2:
                R += M[i][j]
    return R
def RealresistanceC():
    "Return a value of resistance RC"
    R=0
    for i in range(0,int(math.sqrt(M.size))):
        for j in range(0,int(math.sqrt(M.size))):
            if paint_matrix[i][j]==3:
                R +=M[i][j]
    return R
def RealresistanceD():
    "Return a value of resistance RD"
    R=0
    for i in range(0,int(math.sqrt(M.size))):
        for j in range(0,int(math.sqrt(M.size))):
            if paint_matrix[i][j]==4:
                R += M[i][j]
    return R
def IdealresistanceA():
    "Return a value of resistance RA"
    R=0
    for i in range(0,int(math.sqrt(M.size))):
        for j in range(0,int(math.sqrt(M.size))):
            if paint_matrix[i][j]==1:
                R +=I[i][j]
    return R
def IdealresistanceB():
    "Return a value of resistance RB"
    R=0
    for i in range(0,int(math.sqrt(M.size))):
        for j in range(0,int(math.sqrt(M.size))):
            if paint_matrix[i][j]==2:
                R += I[i][j]
    return R
def IdealresistanceC():
    "Return a value of resistance RC"
    R=0
    for i in range(0,int(math.sqrt(M.size))):
        for j in range(0,int(math.sqrt(M.size))):
            if paint_matrix[i][j]==3:
                R +=I[i][j]
    return R
def IdealresistanceD():
    "Return a value of resistance RD"
    R=0
    for i in range(0,int(math.sqrt(M.size))):
        for j in range(0,int(math.sqrt(M.size))):
            if paint_matrix[i][j]==4:
                R += I[i][j]
    return R

In [47]:
RrA=RealresistanceA()
RrB=RealresistanceB()
RiA=IdealresistanceA()
RiB=IdealresistanceB()
print("RealresistanceA: "+str(RrA))
print("RealresistanceB: "+str(RrB))
print("IdealresistanceA: "+str(RiA))
print("IdealresistanceB: "+str(RiB))
print("Porcentaje de diferencia entre los valores reales")
EAB=(1-(RrA/RrB))*100
print("Error Between Real resistances: "+str(EAB)+" %")
print("Porcentaje de diferencia entre las resistencia ideal y las resistencias reales")
EAI=(1-(RiA/RrA))*100
EBI=(1-(RiB/RrB))*100
print("Error RA vs RIA: "+str(EAI)+" %")
print("Error RB vs RIB: "+str(EBI)+" %")


RealresistanceA: 2688.0
RealresistanceB: 2688.0
IdealresistanceA: 2520.0
IdealresistanceB: 2520.0
Porcentaje de diferencia entre los valores reales
Error Between Real resistances: 2.22044604925e-14 %
Porcentaje de diferencia entre las resistencia ideal y las resistencias reales
Error RA vs RIA: 6.25 %
Error RB vs RIB: 6.25 %

Para las 4 resistencias de centroide comun


In [17]:
RrA=RealresistanceA()
RrB=RealresistanceB()
RrC=RealresistanceC()
RrD=RealresistanceD()
RiA=IdealresistanceA()
RiB=IdealresistanceB()
RiC=IdealresistanceC()
RiD=IdealresistanceD()
print("RealresistanceA: "+str(RrA))
print("RealresistanceB: "+str(RrB))
print("RealresistanceC: "+str(RrC))
print("RealresistanceD: "+str(RrD))
print("IdealresistanceA: "+str(RiA))
print("IdealresistanceB: "+str(RiB))
print("IdealresistanceC: "+str(RiC))
print("IdealresistanceD: "+str(RiD))
print("Porcentaje de diferencia entre los valores reales")
EAB=(1-(RrA/RrB))*100
EAC=(1-(RrA/RrC))*100
EAD=(1-(RrA/RrD))*100
ECB=(1-(RrC/RrB))*100
ECD=(1-(RrC/RrD))*100
EDB=(1-(RrD/RrB))*100
print("Error Between Real resistances:")
print(str(EAB)+" %")
print(str(EAC)+" %")
print(str(EAD)+" %")
print(str(ECB)+" %")
print(str(ECD)+" %")
print(str(EDB)+" %")

print("Porcentaje de diferencia entre las resistencia ideal y las resistencias reales")
EAI=(1-(RiA/RrA))*100
EBI=(1-(RiB/RrB))*100
print("Error RA vs RIA: "+str(EAI)+" %")
print("Error RB vs RIB: "+str(EBI)+" %")


RealresistanceA: 384.0
RealresistanceB: 384.0
RealresistanceC: 384.0
RealresistanceD: 384.0
IdealresistanceA: 360.0
IdealresistanceB: 360.0
IdealresistanceC: 360.0
IdealresistanceD: 360.0
Porcentaje de diferencia entre los valores reales
Error Between Real resistances:
-2.22044604925e-14 %
-2.22044604925e-14 %
-2.22044604925e-14 %
-2.22044604925e-14 %
0.0 %
-2.22044604925e-14 %
Porcentaje de diferencia entre las resistencia ideal y las resistencias reales
Error RA vs RIA: 6.25 %
Error RB vs RIB: 6.25 %

In [11]: